package title;

import game.Game;

import org.newdawn.slick.*;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.state.*;
import org.lwjgl.input.Mouse;

public class Title extends BasicGameState {

	Image titleScreen, newGame;
	Texture newtext;
	
	public Title (int state){
		}
	
	@Override
	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{	
		
	
		titleScreen = new Image("res/title/titleScreen.png");
		newGame = new Image("res/title/newGame.png");
	
	}
	
	@Override
	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
		
		int posX = Mouse.getX();
		int posY = Mouse.getY();
		
		titleScreen.draw(0, 0);
		
		newGame.draw((Game.WIDTH / 2) - 150, (Game.HEIGHT / 2) - 25);
		newGame.draw((Game.WIDTH / 2) - 150, (Game.HEIGHT / 2) + 50);
		newGame.draw((Game.WIDTH / 2) - 150, (Game.HEIGHT / 2) + 125);
		newGame.draw((Game.WIDTH / 2) - 150, (Game.HEIGHT / 2) + 200);
		
		g.drawString("X:" + posX + " Y:" + posY, 400, 20);
		
	
	}
	
	@Override
	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
		
		int posX = Mouse.getX();
		int posY = Mouse.getY();
		
		//new game
			if( (posX >= 250 && posX <= 550) && (posY >= 275 && posY <= 300) ){
						
						if(Mouse.isButtonDown(0)){sbg.enterState(Game.WORLD);}
					}
					
			//1
			if( (posX >= 250 && posX <= 550) && (posY >= 200 && posY <= 250) ){
						
						if(Mouse.isButtonDown(0)){sbg.enterState(Game.COMBAT);}
					}
			
			//2
			if( (posX >= 250 && posX <= 550) && (posY >= 125 && posY <= 175) ){
						
						if(Mouse.isButtonDown(0)){sbg.enterState(Game.MENU);}
					}
			
			//3
			if( (posX >= 250 && posX <= 550) && (posY >= 50 && posY <= 100) ){
						
						if(Mouse.isButtonDown(0)){System.exit(0);}
					}
		
	}
	

	@Override
	public int getID() {return 0;}	
}
